﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ContactMvc4TB.Helpers.RightsManagement;
using Mvc4WebApiKoTb.Models;
using Mvc4WebApiKoTb.Models.HomeModels;

namespace Mvc4WebApiKoTb.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult EditListItems()
        {
            EditListItemsModel model = new EditListItemsModel();
            model.LoadListItems();

            return View(model);
        }

        [HttpPost]
        public ActionResult EditListItems(EditListItemsModel model)
        {
            //Die Postback Modeldaten verarbeiten

            return View(model);
        }

        public ActionResult Index()
        {
            ViewBag.Message = "Modify this ...";

            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }

        public ActionResult Person()
        {
            PersonModel model = new PersonModel();
            model.LoadData();
            return View(model);
        }

        public ActionResult TimeSlider()
        {
            return View();
        }

        public ActionResult Html5Canvas()
        {
            return View();
        }

        public ActionResult HtmlSvg()
        {
            return View();
        }

        public ActionResult CustomValidation()
        {
            CustomValidationModel model = new CustomValidationModel();
            model.Initilize();
            return View("CustomValidation", model);
        }

        [HttpPost]
        public ActionResult CustomValidation(CustomValidationModel model)
        {
            if (ModelState.IsValid)
            {
                //TODO Valides Model - Aufgaben ausführen
            }

            return View("CustomValidation", model);
        }
    }
}
